<div class="tabbable tabs-left">
              <ul class="nav nav-tabs">
              	<li><h5><?php echo $this->translate('分类信息'); ?></h5></li>
                <li class="active"><a data-toggle="tab" href="#class_a"><?php echo $this->translate('基本信息'); ?></a></li>
<!--                <li class=""><a data-toggle="tab" href="#class_c">--><?php //echo $this->translate('搜索引擎优化'); ?><!--</a></li>-->
              </ul>
              <form class="form-horizontal" method="post" name="class_add_form" id="class_add_form">
              <input type="hidden" name="class_save_type" id="class_save_type" value="" />
              <div class="tab-content">
    			<div id="sticky_navigation" style="height:30px;border-bottom:4px solid #DFDFDF;">
        			<div class="pull-left" style="font-size:16px;line-height:30px;"><strong><?php if($this->article_class_info) echo $this->translate('编辑'); else echo $this->translate('新加'); ?><?php echo $this->translate('图文分类'); ?></strong></div>
        			<div id="sticky_navigation_right" class="pull-right">
                	<a href="<?php echo $this->url('Imagetext/default',array('action'=>'index','controller'=>'class')); ?>" class="btn btn-small"><i class="icon-arrow-left"></i> <?php echo $this->translate('返回分类列表'); ?></a>&nbsp;
                	<a href="<?php echo $this->serverUrl(true); ?>" class="btn btn-small btn-warning"><i class="icon-repeat icon-white"></i> <?php echo $this->translate('刷新'); ?></a>&nbsp;
                    <?php if($this->article_class_info) { ?>
                    <a href="javascript:;" onclick="return class_del_js(<?php echo $this->article_class_info->article_class_id ?>)" class="btn btn-small btn-danger"><i class="icon-remove icon-white"></i> <?php echo $this->translate('删除分类'); ?></a>&nbsp;
                    <button type="submit" onclick="$('#class_save_type').val('save_return_edit');" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存分类并继续编辑'); ?></button>&nbsp;
                    <?php } ?>
                	<button type="submit" onclick="$('#class_save_type').val('');" class="btn btn-small btn-primary"><i class="icon-ok icon-white"></i> <?php echo $this->translate('保存分类'); ?></button>&nbsp;
<!--                	<a href="--><?php //echo $this->myviewalias()->dbshopHelpUrl('Imagetext_class_set'); ?><!--" target="_blank" class="btn btn-small btn-info"><i class="icon-info-sign icon-white"></i> --><?php //echo $this->translate('查看帮助说明'); ?><!--</a>-->
                	</div>
        		</div>
                <div id="class_a" class="tab-pane active">
                	<div class="well admin_add_header_well"><?php echo $this->translate('基本信息'); ?></div>
                	<div class="well admin_add_well">
                        <div class="message_one">
                    	</div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('分类名称'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<input type="text" id="article_class_name"  name="article_class_name" value="<?php echo ($this->article_class_info ? $this->escapeHtml($this->article_class_info->article_class_name) : ''); ?>" class="span12">
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('分类状态'); ?><span class="must_add_value">*</span>：</label>
           					<div class="controls">
              					<select id="article_class_state" name="article_class_state" class="span2">
                                <option value="1" <?php if($this->article_class_info and $this->article_class_info->article_class_state == 1) echo 'selected="selected"'; ?>><?php echo $this->translate('启用'); ?></option>
                                <option value="0" <?php if($this->article_class_info and $this->article_class_info->article_class_state == 0) echo 'selected="selected"'; ?>><?php echo $this->translate('禁用'); ?></option>
                                </select>
            				</div>                        
                        </div>
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('上级分类'); ?>：</label>
           					<div class="controls">
              					<select id="article_class_top_id" name="article_class_top_id" class="span2">
                                <option value="0"><?php echo $this->translate('顶级分类'); ?></option>
                                <?php
                                if ($this->article_class) {
                                	foreach ($this->article_class as $class_val) {
								?>
                                <option value="<?php echo $class_val['article_class_id'] ?>" <?php if(($this->article_class_info and $this->article_class_info->article_class_top_id == $class_val['article_class_id']) or ($class_val['article_class_id'] == $this->article_class_top_id)) { ?>selected="selected"<?php } ?>><?php echo str_repeat('&nbsp;', $class_val['class_level'] * 5).$class_val['article_class_name']; ?></option>
                                <?php
                                	}
                                }
								?>
                                </select>
            				</div>                        
                        </div>
                    	<!-- <div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('分类描述'); ?>：</label>
           					<div class="controls">
              					<script type="text/plain" id="article_class_info" name="article_class_info"><?php if($this->article_class_info and $this->article_class_info->article_class_info) echo $this->article_class_info->article_class_info; ?></script>
            				</div>                        
                        </div> -->
                    	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('分类排序'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="article_class_sort" name="article_class_sort" class="span2" value="<?php if($this->article_class_info and $this->article_class_info->article_class_sort) echo $this->article_class_info->article_class_sort; else echo '255'; ?>">
            				</div>                        
                        </div>
                        <?php if($this->myviewalias()->defaultShopSet('dbshop_news', 'index')) { ?>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('设为首页新闻'); ?>：</label>
                            <div class="controls">
                                <label class="checkbox inline"><input type="checkbox" name="index_news" <?php if($this->article_class_info and $this->article_class_info->index_news == 1) echo 'checked'; ?> value="1"></label>
                            </div>
                        </div>
                        <?php } ?>
                  	</div>
                </div>
                
                 <div id="class_c" class="tab-pane">
                	<div class="well admin_add_header_well"><?php echo $this->translate('搜索引擎优化'); ?></div>
                	<div class="well admin_add_well">
                        <div class="message_one">
                    	</div>
                     	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('扩展标题'); ?>：</label>
           					<div class="controls">
              					<input type="text" id="article_class_extend_name" value="<?php if($this->article_class_info and $this->article_class_info->article_class_extend_name) echo $this->escapeHtml($this->article_class_info->article_class_extend_name); ?>"  name="article_class_extend_name" class="span12">
            				</div>                        
                        </div>
                     	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('图文分类关键词'); ?>：</label>
           					<div class="controls">
              					<textarea class="span12" rows="1" name="article_class_keywords" id="article_class_keywords"><?php if($this->article_class_info and $this->article_class_info->article_class_keywords) echo $this->escapeHtml($this->article_class_info->article_class_keywords); ?></textarea>
            				</div>                        
                        </div>
                     	<div class="control-group">
                  			<label for="input01" class="control-label"><?php echo $this->translate('图文分类描述'); ?>：</label>
           					<div class="controls">
              					<textarea class="span12" rows="3" name="article_class_description" id="article_class_description"><?php if($this->article_class_info and $this->article_class_info->article_class_description) echo $this->escapeHtml($this->article_class_info->article_class_description); ?></textarea>
            				</div>                        
                        </div>                                          
                  	</div>                                         
              </div>
             </div>
              </form>
</div>
<?php 
/*echo $this->partial('common/editor',array('edit_array'=>array('article_class_info'),
'edit_config'=>array(
"toolbars:[['FullScreen', 'Source', 'Undo', 'Redo','Bold']]",
"wordCount:false",
"initialFrameHeight:100",
"elementPathEnabled:false",
"maximumWords:500"
)));*/
 ?>

<script>
//分类保存验证
$(document).ready(function() {
	$("#class_add_form").validate({
		rules: {
			article_class_name: {
				required: true,
				minlength:2,
				maxlength:50
			},
			article_class_state: {
				required: true
			},
			<?php if($this->article_class_info) { ?>
			article_class_top_id: {
				remote :{
					url : '<?php echo $this->url('Imagetext/default/article_class_id',array('controller'=>'class','action'=>'checkclasstop','article_class_id'=>$this->article_class_info->article_class_id)); ?>',
					type : 'post',
					date : {
						article_class_top_id :function(){
							return $('#article_class_top_id').val();
						}
					}
				}
			},
			<?php } ?>
			article_class_sort: {
				number: true,
				min:1,
				max:255
			},
			article_class_extend_name: {
				maxlength:30
			},
			article_class_keywords: {
				maxlength:80
			},
			article_class_description: {
				maxlength:300
			}
		},
		messages: {
			article_class_name: {
				required: "<?php echo $this->translate('请输入分类名称！'); ?>",
				minlength:"<?php echo $this->translate('分类名称最短2个字符！'); ?>",
				maxlength:"<?php echo $this->translate('分类名称最长为50位字符！'); ?>"
			},
			article_class_state: {
				required: "<?php echo $this->translate('请选择分类状态'); ?>"
			},
			<?php if($this->article_class_info) { ?>
			article_class_top_id: {
				remote : "<?php echo $this->translate('上级分类不能为自己下级分类或本身分类！'); ?>"
			},
			<?php } ?>
			article_class_sort: {
				number: "<?php echo $this->translate('分类排序必须为数字'); ?>",
				min:"<?php echo $this->translate('分类排序最小为1'); ?>",
				max:"<?php echo $this->translate('分类排序最大为255'); ?>"
			},
			article_class_extend_name: {
				maxlength:"<?php echo $this->translate('扩展标题最长为30个字符！'); ?>"
			},
			article_class_keywords: {
				maxlength:"<?php echo $this->translate('图文分类关键字最长为80个字符！'); ?>"
			},
			article_class_description: {
				maxlength:"<?php echo $this->translate('图文分类描述最长为300个字符！'); ?>"
			}
		}
	});
});
//分类删除操作js，检查分类下是否有子分类
function class_del_js(article_class_id) {
	if(window.confirm('<?php echo $this->translate('您确实要删除该分类吗？'); ?>')) {
	$.post("<?php echo $this->url('Imagetext/default',array('action'=>'del','controller'=>'class')); ?>",{article_class_id:article_class_id},
	function(data){
		if(data == 'true') {
			window.location.href='<?php echo $this->url('Imagetext/default',array('controller'=>'class')); ?>';
			return true;
		} else {
			if(data == 'error_article') {
				alert('<?php echo $this->translate('该分类下还有图文，无法删除该分类！'); ?>');
				return false;	
			}
			alert('<?php echo $this->translate('该分类下还有子分类，无法删除该分类！'); ?>');
		}
	});
	}
	return false;
}

<?php if ($this->success_msg != '') { ?>
show_message('.message_one','<?php echo date("Y-m-d H:i:s"); ?>','<?php echo $this->success_msg; ?>','alert-success');
<?php } ?>
</script>
